package com.jic.market.controller.manage;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * description: CaffeineController
 * date: 2020/2/24 17:45
 * author: wangys
 * version: 1.0
 */
@RestController
@RequestMapping("caffeine")
@CacheConfig(cacheManager = "caffeineCacheManager")
public class CaffeineController {
//    .put("s30", "maximumSize=5000,expireAfterWrite=30s")
//					.put("m1", "maximumSize=5000,expireAfterWrite=1m")
//					.put("m10", "maximumSize=5000,expireAfterWrite=10m")
//					.put("1h", "maximumSize=5000,expireAfterWrite=1h")
    @GetMapping("m1")
    @Cacheable(value = "m1")
    public String m1() {
        return "m1";
    }

    @GetMapping("s30")
    @Cacheable(value = "s30")
    public String s30() {
        return "s30";
    }

    @GetMapping("m10")
    @Cacheable(value = "m10")
    public String m10() {
        return "m10";
    }

}
